<template>
  <el-avatar
      :src="avatarImgUrl"
      fit="cover"
      :size="props.size"
      :preview-src-list="[avatarImgUrl]"
  />
</template>

<script setup>
import {computed} from "vue";
import {imgUrl} from "@/utils/http.js";

const props = defineProps({
  src: String,
  size: String
})
const avatarImgUrl = computed(() => {
  //判断是是http开头的
  if (props.src.startsWith('http')) {
    return props.src
  } else {
    return imgUrl+props.src
  }
})
</script>

<style scoped>

</style>